<div class="bjui-pageContent">
    <div class="bjui-pageHeader" style="background-color:#fefefe; border-bottom:none;">
        <form data-toggle="ajaxsearch" data-options="{searchDatagrid:$.CurrentNavtab.find('#process-dict-lists')}">
            <fieldset>
                <legend style="font-weight:normal;">搜索：</legend>
                <div style="margin:0; padding:1px 5px 5px;">

                    <span>名称：</span>
                    <input type="text" name="title" class="form-control" size="30">

                    <div class="btn-group">
                        <button type="submit" class="btn-green" data-icon="search">开始搜索</button>
                        <button type="reset" class="btn-orange" data-icon="times">重置</button>
                    </div>
                </div>
            </fieldset>
        </form>
    </div>
    <table class="table table-bordered" id="process-dict-lists" data-toggle="datagrid" data-options="{
        tableWidth: '100%',
        height: '100%',
        gridTitle : '订单第一步字段列表',
        showToolbar: true,
        toolbarItem: '{{$toolbarItem}}',
        local: 'local',
        dataUrl: '/admin/process/order-dict',
        linenumberAll: false,
        showLinenumber: false,
        showCheckboxcol: true,
        filterThead: false,
        showEditbtnscol: '操作',
        customEditbtns:{ position:'replace',buttons:editButton,width:0},
        editUrl: '/admin/process/order-edit',
        editCallback:editCallback,
        delUrl:'/admin/process/order-delete',
        delPK:'id',
        delConfirm: true,
    }">
        <thead>
        <tr>
            <th data-options="{name:'id',width:50,align:'center',add:false,edit:false}">编号</th>
            <th data-options="{name:'field_name',add:false,edit:false,align:'center'}">字段名称</th>
            <th data-options="{name:'title',align:'center'}">名称</th>
            <th data-options="{name:'placeholder',align:'center'}">提示语</th>
            <th data-options="{name:'text_type',type:'select',items:[{0:'字符'},{1:'数字'},{2:'带小数点数字'}],align:'center'}">文本类型</th>
            <th data-options="{name:'field_type',type:'select',items:{{$fieldTypeList}},align:'center'}">字段类型</th>
            <th data-options="{name:'orderby',align:'center'}">排序</th>
            <th data-options="{name:'is_must',type:'select',items:[{0:'选填'},{1:'必填'}],align:'center'}">是否必填</th>
            <th data-options="{name:'status',type:'select',items:[{0:'禁用'},{1:'启用'}],align:'center'}">状态</th>
            <th data-options="{align:'center',render:processOrderDictSet}">设置</th>
        </tr>
        </thead>
    </table>
</div>
<script type="text/javascript">
    function processOrderDictSet(value, data)
    {
        var html  = '<button type="button" class="btn btn-info" data-toggle="navtab" data-options="';
        html  += '{id:\'process-field-set-navtab\',title:\''+data.title+'设置\',fresh:true,';
        html  += 'url:\'/admin/process/order-field-set\',data:{field_id:' + data.id + '}}';
        html  += '">设置</button>';
        var arr   = [ 3, 5, 11, 13, 14 ];
        if( field_type_in_array(data.field_type, arr) ){
            return html;
        } else {
            return '';
        }
    }
    function field_type_in_array( field_type, arr ){
        for(var i in arr){
            if( arr[i] == field_type ){
                return true;
            }
        }
        return false;
    }
</script>